/*
 *    Copyright (c) 2018-2025, cycas-ui All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the cycas-ui_cloud.com developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: cycas-ui (cycas-ui@gmail.com)
 */
import store from "@/store";
export const tableOption = {
  border: false,
  index: true,
  indexLabel: '序号',
  stripe: true,
  menuWidth:160,
  menuAlign:'center',
  menuHeaderAlign:'center',
  searchMenuSpan: 6,
  align: 'center',
  addBtn: true,
  editBtn: true,
  delBtn: true,
  column: [{
    label: 'app编码',
    prop: 'appCode',
    span: 24,
    editDisabled: true,
    rules: [{
      required: true,
      message: 'app编码不能为空',
      trigger: 'blur'
    },
    {
      min: 3,
      max: 20,
      message: '长度在 3 到 20 个字符',
      trigger: 'blur'
    }]
  }, {
    width: 120,
    label: 'app名称',
    prop: 'appName',
    span: 24,
    search: true,
    rules: [{
      required: true,
      message: 'app名称不能为空',
      trigger: 'blur'
    },
      {
        min: 3,
        max: 20,
        message: '长度在 3 到 20 个字符',
        trigger: 'blur'
      }
    ]
  },{
    label: 'app类型',
    prop: 'appType',
    type: 'select',
    dicHeaders: {"Authorization": "Bearer " + store.getters.access_token},
    dicMethod: 'get',
    dicUrl: '/sys/api/v1/sysDictItem/list/APP_TYPE',
    dicFormatter: (res) => {
      console.log("appType res:{}",res);
      res.data.forEach(item => {
        // 字段类型必须和列表返回的字段类型一直(string=string,int=int)
        item.dictItemCode = parseInt(item.dictItemCode)
      })
      return res.data
    },
    props: {
      label: "dictItemName",
      value: "dictItemCode"
    },
    rules: [{
      required: true,
      message: 'app类型不能为空',
      trigger: 'blur'
    }],
  },{
    label: 'app版本',
    prop: 'appVersion',
    span: 24,
    rules: [{
      required: true,
      message: 'app版本不能为空',
      trigger: 'blur'
      }, {
        min: 3,
        max: 20,
        message: '长度在 3 到 20 个字符',
        trigger: 'blur'
      }]
  }, {
    label: 'app状态',
    prop: 'appStatus',
    type: 'select',
    slot: true,
    editDisplay: false,
    addDisplay: false,
  }, {
    label: '附件名称',
    prop: 'attName',
    editDisplay: false,
    addDisplay: false,
    overHidden: true
  }, {
    label: '附件大小(byte)',
    prop: 'attSize',
    editDisplay: false,
    addDisplay: false,
  }, {
    label: '附件路径',
    prop: 'attPath',
    editDisplay: false,
    addDisplay: false,
    overHidden: true
  },{
    label: '创建时间',
    prop: 'createTime',
    type: 'datetime',
    format: 'yyyy-MM-dd HH:mm:ss',
    valueFormat: 'yyyy-MM-dd HH:mm:ss',
    editDisplay: false,
    addDisplay: false,
    width: 150
  },{
    label: "软件包",
    prop: "file",
    type: "upload",
    hide: true,
    formslot: true,
    slot: true
  }]
}
